package com.wang.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wang.dao.IUserDao;
import com.wang.domain.User;
import com.wang.service.IUserService;
@Service
public class UserService implements IUserService {
	@Autowired
	private IUserDao userDao;
	@Override
	public void add(User user) {
		if(user.getId() == null){
			userDao.add(user);
		}else{
			userDao.update(user);
		}
	}

	@Override
	public void delete(Long id) {
		userDao.delete(id);
	}

	@Override
	public User queryOne(Long id) {
		return userDao.queryOne(id);
	}

	@Override
	public List<User> queryAll() {
		return userDao.queryAll();
	}

}
